package com.tz.colawallet.ui.presenter;

import com.tz.colawallet.basecode.base.BaseBiz;
import com.tz.colawallet.basecode.base.BaseRespNew;
import com.tz.colawallet.bean.Recommand;
import com.tz.colawallet.bean.UserMessage;
import com.tz.colawallet.ui.biz.MainFirstFragBiz;
import com.tz.colawallet.ui.biz.MainThirdFragBiz;
import com.tz.colawallet.ui.contract.MainFirstFragContract;
import com.tz.colawallet.ui.contract.MainThirdFragContract;

import java.util.List;

import javax.inject.Inject;

/**
 * Created by Administrator on 2017/10/25.
 */

public class MainThirdFragPresenter implements MainThirdFragContract.MainThirdFragPresenter {

    MainThirdFragContract.View view;
    MainThirdFragBiz biz;

    @Inject
    public MainThirdFragPresenter(MainThirdFragContract.View view) {
        this.view = view;
    }


    @Override
    public void setBiz(BaseBiz biz) {
        this.biz = (MainThirdFragBiz) biz;
    }

    @Override
    public void getUserDetail() {
        view.loading(true);
        biz.getUserDetail(view.curContext(), new BaseBiz.Callback<BaseRespNew<UserMessage>>() {
            @Override
            public void onSuccess(BaseRespNew<UserMessage> o) {
                view.showUserDetail(o.getData());
                view.loading(false);
            }

            @Override
            public void onFailure(BaseRespNew o) {
                view.showMsg(o.getMsg());
                view.loading(false);
            }
        });
    }

}
